
function DoSaveSnapshot(figure_handle);

[filename,pathname,FilterIndex]=uiputfile({ '*.bmp','Windows Bitmap (*.bmp)';...
                                '*.hdf','Hierarchical Data Format (*.hdf)';...
                                '*.jpg','Joint Photographic Experts Group (*.jpg)';...
                                '*.pbm','Portable Bitmap (*.pbm)';...
                                '*.pgm','Portable Graymap (*.pgm)';...
                                '*.png','Portable Network Graphics (*.png)';...
                                '*.pnm','Portable Anymap (*.pnm)';...
                                '*.ppm','Portable Pixmap (*.ppm)';...
                                '*.ras','Sun Raster (*.ras)';...
                                '*.tif','Tagged Image File Format (*.tif)'},...
                                'Save image','Untitled.bmp');
if filename==0
        return;
end

F=getframe(figure_handle);  % Only want to get figure.
imwrite(F.cdata,[pathname, filename]);  % Write the image.

end